package com.zzyx.dao.impl;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.zzyx.bean.Yuyue;

import com.zzyx.dao.YuyueDao;

public class YuyueDaoImpl extends BaseDAOImpl<Yuyue, Integer> implements
		YuyueDao {
	public void update(Yuyue entity)
	{
		Session session=this.getSession();
		Transaction tr=session.beginTransaction();
		Query query=session.createQuery("update Yuyue y set y.state='"+entity.getState()+"' where y.id='"+entity.getId()+"'");
		if(query.executeUpdate()==1)
		{
			tr.commit();
		}
		else
		{
			tr.rollback();
		}
	}
}
